<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of conexion
 *
 * @author Edgar_Funez
 */
class conectar
{
	private $conexion;
	
			
			
        public static function conecta()
        	{
				$conexion= pg_connect("user=postgres password=hector port=5432 dbname=AutoRepuestos host=localhost");
                                return $conexion;
                                
                }
		
		public static function cerrar()
        	{
				pg_close($conexion);
			}
			
		public static function query($sql)
			{
			conecta();
                        $resultado=pg_query($conexion,$sql) or die('error al ejecutar consulta'.mysqli_error($conexion) );
			cerrar($conexion);
			return $resultado;
			}

}
?>